import {baseRequest} from '@/utils/request'

const request = (url, ...arg) => baseRequest(`/process/comp/` + url, ...arg)

export default {
	async queryCompList(data){
		return await request('list', data, 'post')
	},
	async removeCompConfig(data){
		return await request('remove_by_id', data, 'post')
	},
	async getById(data){
		return await request('get_by_id', data, 'post')
	},
	async save(data){
		return await request('save', data, 'post')
	},
	async saveFile(data){
		return await request('object/save', data, 'post')
	},
	async downloadDemo(){
		return await request('object/download_demo', {}, 'get', {
			responseType: 'blob'
		})
	},
	async getFile(compCode,compVersion){
		return await request(`object/get_file?compCode=${compCode}&compVersion=${compVersion}`, {}, 'get', {
			responseType: 'blob'
		})
	},
	async saveAndRebuild(data){
		return await request('object/save_and_rebuild', data, 'post')
	},

}
